package moltencore.game;

public class ScoreCalculator{
	private static final double MULTIPLIER_INCREMENT = 0.1;
	private static final int MULTIPLIER_INCREMENT_THRESHOLD = 3;
	private static final int BUBBLE_DEFAULT_VALUE = 100;

	private double currentMultiplier;
	private int currentDroppedBubbles;

	public ScoreCalculator(){
	}

	public void startNewBubbleDrop(){
		currentMultiplier = 1;
		currentDroppedBubbles = 0;
	}

	public void setChainBubbles(int bubbles){
		currentDroppedBubbles = bubbles;
		if (bubbles > MULTIPLIER_INCREMENT_THRESHOLD){
			currentMultiplier += ((bubbles - MULTIPLIER_INCREMENT_THRESHOLD) * MULTIPLIER_INCREMENT);
		}

	}

	public void addBranchBubbles(int bubbles){
		currentDroppedBubbles += bubbles;
		currentMultiplier += bubbles * MULTIPLIER_INCREMENT;
	}

	public float calculateScore(){
		return (float)(currentMultiplier * currentDroppedBubbles * BUBBLE_DEFAULT_VALUE);
	}
}
